//
//  ChoiceFooterViewModel.swift
//  cxd4iphone
//
//  Created by hexy on 12/8/15.
//  Copyright © 2015 hexy. All rights reserved.
//

import UIKit

class BidViewModel: NSObject {

    var bidModel: BidModel
    
 
    var minInvestMoney: String {
        
        return "\(bidModel.minInvestMoney)"
    }
    
    var lastTime: String {
        
        return "\(bidModel.deadline)"
    }
    var beiginInvestNum: String {
        
        return "\(bidModel.minInvestMoney)"
    }
    var investLastNum: String {
        
        return "\(bidModel.deadline)"
    }
    var investLastUnit: String {
        
        return bidModel.unit ?? "天"
    }
    
    var percent: String {
        
        return "\(bidModel.progress)%"
    }
    
    var progress: Float {
        
        return Float(bidModel.progress) / Float(100.0)
    }
    
    var investLastTime: String {
        
        
        return " \(bidModel.deadline)\(bidModel.unit!)封闭期"
    }
    var releaseTime: String {
        
        return " 发布时间:\(bidModel.exceptTime!)"
    }
    var rate: Double {
        
        return (bidModel.rate! as NSString).doubleValue / 100
    }
    
    var time: Double {
        
        let deadline = Double(bidModel.deadline)
        return (bidModel.unit! == "天") ? deadline : deadline * 30.0
    }
    
    var inputValue: Double = 0.0
    
    var expectProfit: String {
        
        return String.num3Formmter(rate / 365.0 * time * inputValue)
    }
    // MARK: - 构造函数
    init(bidModel: BidModel) {
        self.bidModel = bidModel
        
        
        super.init()
    }

}
